* This code is for the replication of Gagnon and Jeanneret's "How Does Corporate Governance Affect Equity Volatility? Worldwide Evidence and Theory", Review of Corporate Finance Studies, https://academic.oup.com/rcfs/advance-article/doi/10.1093/rcfs/cfad002/7031253.


* Insert folder for input files
local input_data_folder ""
* Insert folder for output files
local results_folder "/Users/louisgagnon/Downloads/"


* Highlight and run the entire code included below
use "`input_data_folder'gj_volatility_rcfs_20221012.dta", clear

* Table I 
tabulate country if in_sample == 1

preserve
contract code country if in_sample == 1
tabulate country
restore

tabstat stock_vol_ann if in_sample == 1, statistics(mean) columns(statistics) by(country) 
tabstat stock_vol_ann if in_sample == 1, statistics(p50) columns(statistics) by(country) 
tabstat mbr_year if in_sample == 1, statistics(p50) columns(statistics) by(country)
tabstat fbr_year if in_sample == 1, statistics(p50) columns(statistics) by(country)


* Table II
preserve 
replace cash_sti_to_tassets = cash_sti_to_tassets * 100
tabstat code stock_vol_ann idio syst_vol home_beta world_beta cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage tangibility tobinsq mcap_to_bve cash_growth_w01 ppe_growth_w01 capex_growth_w01 asset_growth_w01 stdebt_issuance_w01 ltdebt_issuance_w01 debt_issuance_w1 equity_issuance_w1 cashflow_growth_w01 pturoa_w01 tax_rate msd_pturoa msd_roa sga_to_assets_w01h cogs_to_assets_w01h market_capitalization_pctgdp ln_gdp_per_capita legal_origin_fren common_law reneg_failure if in_sample == 1, statistics(mean sd p5 p25 p50 p75 p95 n) columns(statistics)  format(%10.2fc)
restore


* Table III - see paper


* Table IV - see paper


* Table V
local tablename "Table_V.xls"
local depvar "stock_vol_ann"
local indic1 "post_mbr_bi"
local indic2 "post_fbr_bi"
local firmcontrols "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition "if in_sample == 1 & abs(mbr_bi_diff) < 6"
local condition2 "if in_sample == 1 & abs(fbr_bi_diff) < 6"
local option1 ", absorb(firm_id year) "
local option2 ", absorb(year) "
local option3 ", absorb(firm_id) "
local cluster1 "vce(cluster country)"
reghdfe `depvar' `indic1' `indic2' `firmcontrols' `countrycontrols' `condition1' `option1'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of MGR_bi on stock volatility) ctitle(omnibus regression)
reghdfe `depvar' `indic1' `condition' `option1' `cluster1'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) 
reghdfe `depvar' `indic1' `firmcontrols' `condition' `option1' `cluster1'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) 
reghdfe `depvar' `indic1' `firmcontrols' `countrycontrols' `condition' `option1' `cluster1'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) 
reghdfe `depvar' `indic2' `condition2' `option1' `cluster1'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) 
reghdfe `depvar' `indic2' `firmcontrols' `condition2' `option1' `cluster1'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) 
reghdfe `depvar' `indic2' `firmcontrols' `countrycontrols' `condition2' `option1' `cluster1'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) 


* Table VI
local tablename "Table_VI.xls"
local depvar1 "stock_vol_ann"
local depvar2 "idio"
local depvar3 "syst_vol"
local depvar4 "home_beta"
local depvar5 "world_beta"
local indic1 "post_mbr_bi"
local firmcontrolvars "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_bi_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar1' `depvar2' `depvar3' `depvar4' `depvar5' `depvar6' `depvar7' `depvar8' `indic1' `firmcontrolvars1' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of board reforms on firms' risk profile) ctitle(omnibus regression)
reghdfe `depvar1' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar1')
reghdfe `depvar2' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar2')
reghdfe `depvar3' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar3')
reghdfe `depvar4' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar4')
reghdfe `depvar5' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar5')


* Table VII
local tablename "Table_VII.xls"
local varlist "cash_terc tassets_usd_terc tangibility_terc tdebt_to_tassets_terc"
local a: word 1 of `varlist'
foreach i of local varlist {
	generate `i'_1 = 1 if `i' == 1
	replace `i'_1 = 0 if `i' == 3
	generate `i'_3 = 0 if `i' == 1
	replace `i'_3 = 1 if `i' == 3
	reghdfe stock_vol_ann `i'_1 `i'_3 c.`i'_1#i.post_mbr_bi c.`i'_3#i.post_mbr_bi cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage 	market_capitalization_pctgdp ln_gdp_per_capita if in_sample == 1 & abs(mbr_bi_diff) < 6, absorb(firm_id year) vce(cluster country)
	test c.`i'_1#1.post_mbr_bi = c.`i'_3#1.post_mbr_bi
	if "`i'" == "`a'" {
		outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) adds(F-test, r(F), Prob > F, `r(p)') label(insert) title(Impact of MGR_bi on stock volatility) ctitle(`i')
	}
	else outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) adds(F-test, r(F), Prob > F, `r(p)') label(insert) ctitle(`i')
	drop `i'_1 `i'_3
}


* Table VIII
local tablename "Table_VIII.xls"
local indiclist "mbr_bi mbr_acai mbr_scceor mbr_cnbr mbr"
local depvar "stock_vol_ann"
local firmcontrols "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_diff) < 6"
local option1 "absorb(firm_id year) vce(cluster country)"
reghdfe `depvar' post_mbr_bi post_mbr_acai post_mbr_scceor post_mbr_cnbr post_mbr `firmcontrols' `countrycontrols' if `condition1' `condition2', `option1'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) label(insert) title(Components of governance reforms) ctitle(omnibus) 
foreach i of local indiclist {
	reghdfe `depvar' post_`i' `firmcontrols' `countrycontrols' if `condition1' & abs(`i'_diff) < 6, `option1'
	outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) label(insert) ctitle("`i'") 
}


* Table IX
local tablename "Table_IV.xls"
local depvar "stock_vol_ann"
local indic1 "post_mbr_bi"
local indic2 "post_takeoverlaw"
local firmcontrolvars "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "in_sample_with_reg == 1"
local condition3 "& abs(mbr_bi_diff) < 6"
local condition4 "& country != "United States""
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar' `indic1' `indic2' `firmcontrolvars' `countrycontrols' if `condition2' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of MGR_bi on stock volatility) ctitle(omnibus)
reghdfe `depvar' `indic1' `firmcontrolvars' `countrycontrols' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(mbr)
reghdfe `depvar' `indic1' `indic2' `firmcontrolvars' `countrycontrols' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(mbr)
reghdfe `depvar' `indic1' `firmcontrolvars' `countrycontrols' if `condition2' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(incl. reg.)
reghdfe `depvar' `indic1' `firmcontrolvars' `countrycontrols' if `condition1' `condition3' `condition4' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(exc. U.S.)
reghdfe `depvar' `indic1' `firmcontrolvars' `countrycontrols' if `condition1' `condition3' & legal_origin_fren == 1 `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(civil law)
reghdfe `depvar' `indic1' `firmcontrolvars' `countrycontrols' if `condition1' `condition3' & common_law == 1 `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(common law)
reghdfe `depvar' `indic1' reneg_failure `firmcontrolvars' `countrycontrols' if `condition1' `condition3' & reneg_failure_half == 1 `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(reneg_fail_low)
reghdfe `depvar' `indic1' reneg_failure `firmcontrolvars' `countrycontrols' if `condition1' `condition3' & reneg_failure_half == 2 `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(reneg_fail_high)
*


* Table X
local tablename "Table_X.xls"
local depvar1 "op_leverage"
local depvar2 "sga_to_assets_w01h"
local depvar3 "cogs_to_assets_w01h"
local indic1 "post_mbr_bi"
local firmcontrolvars1 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets"
local firmcontrolvars2 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets"
local firmcontrolvars3 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_bi_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar1' `depvar2' `depvar3' `indic1' `firmcontrolvars3' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of board reforms on firms' operating leverage) ctitle(omnibus regression)
reghdfe `depvar1' `indic1' `firmcontrolvars1' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar1')
reghdfe `depvar2' `indic1' `firmcontrolvars2' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar2')
reghdfe `depvar3' `indic1' `firmcontrolvars2' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar3')


* Inputs for Figure 1
* Panel A
local tablename "Timing_stock_vol_ann.xls"
local depvar "stock_vol_ann"
local component "bi"
local indic1 "mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2"
local indic2 "fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2"
local firmcontrols "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_`component'_diff) < 6"
local condition3 "& abs(fbr_`component'_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar' `indic1' `indic2' `firmcontrols' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of `component' governance reforms on stock volatility) ctitle(omnibus regression)
reghdfe `depvar' `indic1' if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(major)
estimates store mgr_`component'_nocontrols
reghdfe `depvar' `indic1' `firmcontrols' `countrycontrols' if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(major)
estimates store mgr_`component'_controls
reghdfe `depvar' `indic2' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(first)
estimates store fgr_`component'_nocontrols
reghdfe `depvar' `indic2' `firmcontrols' `countrycontrols' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(first)
estimates store fgr_`component'_controls
*
local component "bi"
coefplot (mgr_`component'_nocontrols, label(MGR_`component' without controls)) (mgr_`component'_controls, label(MGR_`component' with controls )), yline(0) vertical keep(mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2 fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2) recast(bar) barwidth(0.25) fcolor(*.5) ciopts(recast(rcap)) citop xtitle(Timing of the reforms) rename(mbr_`component'_m1 = t-1 mbr_`component'_0 = t mbr_`component'_1 = t+1 mbr_`component'_2 = t+2 fbr_`component'_m1 = t-1 fbr_`component'_0 = t fbr_`component'_1 = t+1 fbr_`component'_2 = t+2) title("Impact of MGR_`component' on stock volatility")
*
local component "bi"
coefplot (fgr_`component'_nocontrols, label(FGR_`component' without controls)) (fgr_`component'_controls, label(FGR_`component' with controls )), yline(0) vertical keep(mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2 fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2) recast(bar) barwidth(0.25) fcolor(*.5) ciopts(recast(rcap)) citop xtitle(Timing of the reforms) rename(mbr_`component'_m1 = t-1 mbr_`component'_0 = t mbr_`component'_1 = t+1 mbr_`component'_2 = t+2 fbr_`component'_m1 = t-1 fbr_`component'_0 = t fbr_`component'_1 = t+1 fbr_`component'_2 = t+2) title("Impact of FGR_`component' on stock volatility")
*

* Panel B 
local tablename "Timing_asset_vol.xls"
local depvar "msd_roa"
local component "bi"
local indic1 "mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2"
local indic2 "fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2"
local firmcontrols "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_`component'_diff) < 6"
local condition3 "& abs(fbr_`component'_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar' `indic1' `indic2' `firmcontrols' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of `component' governance reforms on asset volatility) ctitle(omnibus regression)
reghdfe `depvar' `indic1' if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(major)
estimates store mgr_`component'_nocontrols
reghdfe `depvar' `indic1' `firmcontrols' `countrycontrols' if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(major)
estimates store mgr_`component'_controls
reghdfe `depvar' `indic2' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(first)
estimates store fgr_`component'_nocontrols
reghdfe `depvar' `indic2' `firmcontrols' `countrycontrols' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(first)
estimates store fgr_`component'_controls
*
local component "bi"
coefplot (mgr_`component'_nocontrols, label(MGR_`component' without controls)) (mgr_`component'_controls, label(MGR_`component' with controls )), yline(0) vertical keep(mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2 fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2) recast(bar) barwidth(0.25) fcolor(*.5) ciopts(recast(rcap)) citop xtitle(Timing of the reforms) rename(mbr_`component'_m1 = t-1 mbr_`component'_0 = t mbr_`component'_1 = t+1 mbr_`component'_2 = t+2 fbr_`component'_m1 = t-1 fbr_`component'_0 = t fbr_`component'_1 = t+1 fbr_`component'_2 = t+2) title("Impact of MGR_`component' on asset volatility")
*
local component "bi"
coefplot (fgr_`component'_nocontrols, label(FGR_`component' without controls)) (fgr_`component'_controls, label(FGR_`component' with controls )), yline(0) vertical keep(mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2 fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2) recast(bar) barwidth(0.25) fcolor(*.5) ciopts(recast(rcap)) citop xtitle(Timing of the reforms) rename(mbr_`component'_m1 = t-1 mbr_`component'_0 = t mbr_`component'_1 = t+1 mbr_`component'_2 = t+2 fbr_`component'_m1 = t-1 fbr_`component'_0 = t fbr_`component'_1 = t+1 fbr_`component'_2 = t+2) title("Impact of FGR_`component' on asset volatility")
*


* Table A.1
local tablename "Table_A1.xls"
local depvar1 "stock_vol_ann"
local depvar2 "tobinsq"
local depvar3 "mcap_to_bve"
local indic1 "post_mbr_bi"
local firmcontrolvars1 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local firmcontrolvars2 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local firmcontrolvars3 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local firmcontrolvars4 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local firmcontrolvars5 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_bi_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar1' `depvar2' `depvar3' `depvar4' `depvar5' `depvar6' `indic1' `firmcontrolvars1' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of board reforms on firms' risk profile) ctitle(omnibus regression)
reghdfe `depvar1' `indic1' `firmcontrolvars2' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar1')
reghdfe `depvar2' `indic1' `firmcontrolvars2' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar2')
reghdfe `depvar3' `indic1' `firmcontrolvars2' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar3')


* Table A.2
* This simulation takes several hours to run. Run this code separately to produce this table.
/* 

* Placebo test - Monte Carlo simulation  

* Panel A: assign the MGR years by random permutation 
set seed 12345
tempfile one two
preserve
contract country_id mbr_bi_year
drop _freq
save `one'
restore
tempname sim
postfile `sim' simnum b_post_mbr_bi se_post_mbr_bi p_post_mbr_bi r2 numobs using "`input_data_folder'results_mbr_bi_sim", every(50) replace
forvalues i = 1/10000 {
	tempfile two
	preserve
	use `one', clear
	keep mbr_bi_year
	rename mbr_bi_year mbr_bi_year_sim
	generate random = runiform()
	sort random
	generate country_id = _n
	save `two'
	restore
	preserve
	merge n:1 country_id using `two'
	keep if _merge == 3
	drop _merge
	generate post_mbr_bi_sim = 0 if year < mbr_bi_year_sim
	replace post_mbr_bi_sim = 1 if post_mbr_bi_sim == .
	generate mbr_bi_diff_sim = mbr_bi_year_sim - year	
	local depvar "stock_vol_ann"
	local indic1 "post_mbr_bi_sim"
	local firmcontrols "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
	local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita" 
	local condition1 "in_sample == 1"
	local condition2 "& abs(mbr_bi_diff_sim) < 6"
	local options ", absorb(firm_id year) vce(cluster country)"
	reghdfe `depvar' `indic1' `firmcontrols' `countrycontrols' if `condition1' `condition2' `options'
	test _b[post_mbr_bi_sim] = 0
    local p_post_mbr_bi = r(p)
	post `sim' (`i') (_b[post_mbr_bi_sim]) (_se[post_mbr_bi_sim]) (`p_post_mbr_bi') (e(r2)) (e(N))
	restore
}
postclose `sim'


* Panel B: assign the MGR year randommly to each sample country 
set seed 12345
tempfile one two
preserve
contract country_id mbr_bi_year
summarize mbr_bi_year
local min = r(min)
local max = r(max)
drop mbr_bi_year
drop _freq
save `one'
restore
tempname sim
postfile `sim' simnum b_post_mbr_bi se_post_mbr_bi t_post_mbr_bi p_post_mbr_bi r2 numobs using "`input_data_folder'results_mbr_bi_sim_v2", every(50) replace
forvalues i = 1/10000 {
	tempfile two
	preserve
	use `one', clear
	egen mbr_bi_year_sim = rndint(), min(`min') max(`max')
	save `two'
	restore
	preserve
	merge n:1 country_id using `two'
	keep if _merge == 3
	drop _merge
	generate post_mbr_bi_sim = 0 if year < mbr_bi_year_sim
	replace post_mbr_bi_sim = 1 if post_mbr_bi_sim == .
	generate mbr_bi_diff_sim = mbr_bi_year_sim - year	
	local depvar "stock_vol_ann"
	local indic1 "post_mbr_bi_sim"
	local firmcontrols "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
	local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
	local condition1 "in_sample == 1"
	local condition2 "& abs(mbr_bi_diff_sim) < 6"
	local options ", absorb(firm_id year) vce(cluster country)"
	capture reghdfe `depvar' `indic1' `firmcontrols' `countrycontrols' if `condition1' `condition2' `options'
	test _b[post_mbr_bi_sim] = 0
	local t_post_mbr_bi = _b[post_mbr_bi_sim]/_se[post_mbr_bi_sim]
    local p_post_mbr_bi = r(p)
	post `sim' (`i') (_b[post_mbr_bi_sim]) (_se[post_mbr_bi_sim]) (`t_post_mbr_bi') (`p_post_mbr_bi') (e(r2)) (e(N))
	restore
}
postclose `sim'

*/

* Body of table 

* Panel A
preserve
use "`input_data_folder'results_mbr_bi_sim.dta", clear
generate tstat = b_post_mbr_bi/se_post_mbr_bi
tabstat b_post_mbr_bi tstat p_post_mbr_bi, statistics(mean min p1 p5 p10 p25 p50 p75 p90 p95 p99 max N) columns(statistics)
restore

*Panel B
preserve
use "`input_data_folder'results_mbr_bi_sim_v2.dta", clear
generate tstat = b_post_mbr_bi/se_post_mbr_bi
tabstat b_post_mbr_bi tstat p_post_mbr_bi, statistics(mean min p1 p5 p10 p25 p50 p75 p90 p95 p99 max N) columns(statistics)
restore

*Panel C
reghdfe stock_vol_ann post_mbr_bi cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage market_capitalization_pctgdp ln_gdp_per_capita if in_sample == 1 & abs(mbr_bi_diff) < 6 , absorb(firm_id year) vce(cluster country)


* Table A.3 - see paper


* Table A.4 - see paper


* Table A.5
local tablename "Table_A5.xls"
local depvar1 "cash_growth_w01"
local depvar2 "ppe_growth_w01"
local depvar3 "capex_growth_w01"
local indic1 "post_mbr_bi"
local firmcontrolvars1 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_bi_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar1' `depvar2' `depvar3' `depvar4' `depvar5' `depvar6'  `indic1' `firmcontrolvars1' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of board reforms on firms' assets) ctitle(omnibus regression)
reghdfe `depvar1' `indic1' `firmcontrolvars1' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar1')
reghdfe `depvar2' `indic1' `firmcontrolvars1' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar2')
reghdfe `depvar3' `indic1' `firmcontrolvars1' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar4')


* Table A.6
local tablename "Table_A6.xls"
local depvar1 "stdebt_issuance_w01"
local depvar2 "ltdebt_issuance_w01"
local depvar3 "debt_issuance_w1"
local depvar4 "equity_issuance_w1"
local depvar5 "tdebt_to_tassets"
local indic1 "post_mbr_bi"
local firmcontrolvars1 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local firmcontrolvars2 "cash_sti_to_tassets ln_tassets_usd roa op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_bi_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar1' `depvar2' `depvar3' `depvar4' `depvar5' `indic1' `firmcontrolvars1' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of board reforms on firms' debt) ctitle(omnibus regression)
reghdfe `depvar1' `indic1' `firmcontrolvars1' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar5')
reghdfe `depvar2' `indic1' `firmcontrolvars1' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar6')
reghdfe `depvar3' `indic1' `firmcontrolvars1' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar7')
reghdfe `depvar4' `indic1' `firmcontrolvars1' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar8')
reghdfe `depvar5' `indic1' `firmcontrolvars2' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar8')


* Table A.7
local tablename "Table_A7.xls"
local depvar1 "stock_vol_ann"
local indic1 "post_mbr_bi"
local firmcontrolvars "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_bi_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar1' `indic1' `firmcontrolvars' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of board reforms on stock volatility) ctitle(omnibus regression)
reghdfe `depvar1' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(stock_vol_ann)
reghdfe `depvar1' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' & tdebt_to_tassets > 0 `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(tobin's q)
reghdfe `depvar1' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' & tdebt_to_tassets == 0 `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(mcap_to_bve)


* Table A.8
local tablename "Table_A8.xls"
local depvar1 "cashflow_growth_w01"
local depvar2 "pturoa"
local depvar3 "roa"
local depvar4 "tax_rate"
local indic1 "post_mbr_bi"
local firmcontrolvars1 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local firmcontrolvars2 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local firmcontrolvars3 "cash_sti_to_tassets ln_tassets_usd     tdebt_to_tassets op_leverage"
local firmcontrolvars4 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local firmcontrolvars5 "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_bi_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar1' `depvar2' `depvar3' `depvar4' `indic1' `firmcontrolvars1' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of board reforms on firms' performance) ctitle(omnibus regression)
reghdfe `depvar1' `indic1' `firmcontrolvars2' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar1')
reghdfe `depvar2' `indic1' `firmcontrolvars2' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar2')
reghdfe `depvar3' `indic1' `firmcontrolvars3' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar3')
reghdfe `depvar4' `indic1' `firmcontrolvars4' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar4')


* Table A.9
local tablename "Table_A9.xls"
local depvar1 "msd_pturoa"
local depvar2 "msd_roa"
local indic1 "post_mbr_bi"
local firmcontrolvars "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_bi_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar1' `depvar2' `indic1' `firmcontrolvars' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of board reforms on firms' risk profile) ctitle(omnibus regression)
reghdfe `depvar1' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar2')
reghdfe `depvar2' `indic1' `firmcontrolvars' `countrycontrols'  if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(`depvar3')


* Inputs for Figure A.1
* Panel A
local tablename "Timing_capex_ratio.xls"
local depvar "capex_ratio_w01h"
local component "bi"
local indic1 "mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2"
local indic2 "fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2"
local firmcontrols "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_`component'_diff) < 6"
local condition3 "& abs(fbr_`component'_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar' `indic1' `indic2' `firmcontrols' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of `component' governance reforms on capex ratio) ctitle(omnibus regression)
reghdfe `depvar' `indic1' if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(major)
estimates store mgr_`component'_nocontrols
reghdfe `depvar' `indic1' `firmcontrols' `countrycontrols' if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(major)
estimates store mgr_`component'_controls
reghdfe `depvar' `indic2' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(first)
estimates store fgr_`component'_nocontrols
reghdfe `depvar' `indic2' `firmcontrols' `countrycontrols' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(first)
estimates store fgr_`component'_controls
*
local component "bi"
coefplot (mgr_`component'_nocontrols, label(MGR_`component' without controls)) (mgr_`component'_controls, label(MGR_`component' with controls )), yline(0) vertical keep(mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2 fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2) recast(bar) barwidth(0.25) fcolor(*.5) ciopts(recast(rcap)) citop xtitle(Timing of the reforms) rename(mbr_`component'_m1 = t-1 mbr_`component'_0 = t mbr_`component'_1 = t+1 mbr_`component'_2 = t+2 fbr_`component'_m1 = t-1 fbr_`component'_0 = t fbr_`component'_1 = t+1 fbr_`component'_2 = t+2) title("Impact of MGR_`component' on capex ratio")
*
local component "bi"
coefplot (fgr_`component'_nocontrols, label(FGR_`component' without controls)) (fgr_`component'_controls, label(FGR_`component' with controls )), yline(0) vertical keep(mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2 fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2) recast(bar) barwidth(0.25) fcolor(*.5) ciopts(recast(rcap)) citop xtitle(Timing of the reforms) rename(mbr_`component'_m1 = t-1 mbr_`component'_0 = t mbr_`component'_1 = t+1 mbr_`component'_2 = t+2 fbr_`component'_m1 = t-1 fbr_`component'_0 = t fbr_`component'_1 = t+1 fbr_`component'_2 = t+2) title("Impact of FGR_`component' on capex ratio")

* Panel B
local tablename "Timing_capex_growth.xls"
local depvar "capex_growth_w01"
local component "bi"
local indic1 "mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2"
local indic2 "fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2"
local firmcontrols "cash_sti_to_tassets ln_tassets_usd roa tdebt_to_tassets op_leverage"
local countrycontrols "market_capitalization_pctgdp ln_gdp_per_capita"
local condition1 "in_sample == 1"
local condition2 "& abs(mbr_`component'_diff) < 6"
local condition3 "& abs(fbr_`component'_diff) < 6"
local options ", absorb(firm_id year) vce(cluster country)"
reghdfe `depvar' `indic1' `indic2' `firmcontrols' `countrycontrols' if `condition1' `options'
outreg2 using "`results_folder'`tablename'", replace stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) title(Impact of `component' governance reforms on asset volatility) ctitle(omnibus regression)
reghdfe `depvar' `indic1' if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(major)
estimates store mgr_`component'_nocontrols
reghdfe `depvar' `indic1' `firmcontrols' `countrycontrols' if `condition1' `condition2' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(major)
estimates store mgr_`component'_controls
reghdfe `depvar' `indic2' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(first)
estimates store fgr_`component'_nocontrols
reghdfe `depvar' `indic2' `firmcontrols' `countrycontrols' if `condition1' `condition3' `options'
outreg2 using "`results_folder'`tablename'", stats(coef se pval) noaster adjr2 bdec(2) tdec(2) word label(insert) ctitle(first)
estimates store fgr_`component'_controls
*
local component "bi"
coefplot (mgr_`component'_nocontrols, label(MGR_`component' without controls)) (mgr_`component'_controls, label(MGR_`component' with controls )), yline(0) vertical keep(mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2 fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2) recast(bar) barwidth(0.25) fcolor(*.5) ciopts(recast(rcap)) citop xtitle(Timing of the reforms) rename(mbr_`component'_m1 = t-1 mbr_`component'_0 = t mbr_`component'_1 = t+1 mbr_`component'_2 = t+2 fbr_`component'_m1 = t-1 fbr_`component'_0 = t fbr_`component'_1 = t+1 fbr_`component'_2 = t+2) title("Impact of MGR_`component' on capex growth")
*
local component "bi"
coefplot (fgr_`component'_nocontrols, label(FGR_`component' without controls)) (fgr_`component'_controls, label(FGR_`component' with controls )), yline(0) vertical keep(mbr_`component'_m1 mbr_`component'_0 mbr_`component'_1 mbr_`component'_2 fbr_`component'_m1 fbr_`component'_0 fbr_`component'_1 fbr_`component'_2) recast(bar) barwidth(0.25) fcolor(*.5) ciopts(recast(rcap)) citop xtitle(Timing of the reforms) rename(mbr_`component'_m1 = t-1 mbr_`component'_0 = t mbr_`component'_1 = t+1 mbr_`component'_2 = t+2 fbr_`component'_m1 = t-1 fbr_`component'_0 = t fbr_`component'_1 = t+1 fbr_`component'_2 = t+2) title("Impact of FGR_`component' on capex growth")
*











